package com.glory.cqaospda.viewmodel

import com.glory.cqaospda.model.TaskRepository
import com.glory.mvvmnet.base.BaseViewModel
import com.glory.mvvmnet.entity.CallObserveBean
import com.google.gson.JsonObject

class EndRunModel :BaseViewModel() {

    private val repository by lazy { TaskRepository() }

    fun defaultBatchTrackOut(map: JsonObject) {
        launchOnlyResult({
            val batchTrackOutBean = repository.defaultBatchTrackOut(map,"EMS_BatchTrackOut")
            defUI.callObserve.value = CallObserveBean(2,batchTrackOutBean)
        })
    }

    fun defaultLotInfo(lotID: String,EquipmentName:String) {
        val map = JsonObject()
        map.addProperty("Lotid", lotID)
        map.addProperty("EquipmentName", EquipmentName)
        launchOnlyResult({
            val defaultLotInfo =
                repository.defaultLotInfo(map,"EMS_GetLotInfo")
            defUI.callObserve.value = CallObserveBean(1,defaultLotInfo)
        })
    }
    fun defaultGetMesRejectData(lotID: String,EquipmentName:String) {
        val map = JsonObject()
        map.addProperty("LotNo", lotID)
        map.addProperty("EquipmentName", EquipmentName)
        launchOnlyResult({
            val mesRejectData =
                repository.defaultGetMesRejectData(map,"EMS_GetMesRejectData")
            defUI.callObserve.value = CallObserveBean(3,mesRejectData)
        })
    }
}